import request from '@/utils/request'
import type { ApiResult, BaseIds, PageSchema } from '@/api/api'
import type { ${className}, ${className}AddDTO, ${className}ModDTO, ${className}QueryDTO } from '@/api/${code}/${className?uncap_first}/type'

const BASE_URL = '/admin/api/v1/${code}/${className?uncap_first}'

const API = {
  BASE_URL,
  PAGE_URL : BASE_URL + '/page',
  LIST_URL : BASE_URL + '/list',
  REMOVE_URL : BASE_URL + '/rm',
}
// 添加${comment}
export const ${className?uncap_first}Add = (data: ${className}AddDTO) => {
  return request.post<any, ApiResult<unknown>>(API.BASE_URL, data)
}
// 修改${comment}
export const ${className?uncap_first}Mod = (data: ${className}ModDTO) => {
  return request.put<any, ApiResult<unknown>>(API.BASE_URL, data)
}
// 删除${comment}
export const ${className?uncap_first}Del = (data: BaseIds) => {
  return request.post<any, ApiResult<unknown>>(API.REMOVE_URL, data)
}
// 查询${comment}
export const ${className?uncap_first}List = (data: ${className}QueryDTO) => {
  return request.post<any, ApiResult<${className}[]>>(API.LIST_URL, data)
}
// 查询分页数据
export const ${className?uncap_first}Query = (data: ${className}QueryDTO) => {
  return request.post<any, ApiResult<PageSchema<${className}>>>(API.PAGE_URL, data)
}

// 详情
export const ${className?uncap_first}Look = (id: string) => {
   return request.get<any, ApiResult<${className}>>(API.BASE_URL + '/' + id)
}
